// --------------------------------------------------------------------------------------------
// Version: MPL 1.1/GPL 2.0/LGPL 2.1
// 
// The contents of this file are subject to the Mozilla Public License Version
// 1.1 (the "License"); you may not use this file except in compliance with
// the License. You may obtain a copy of the License at
// http://www.mozilla.org/MPL/
// 
// Software distributed under the License is distributed on an "AS IS" basis,
// WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
// for the specific language governing rights and limitations under the
// License.
// 
// <remarks>
// Generated by IDLImporter from file nsIApplicationCacheService.idl
// 
// You should use these interfaces when you access the COM objects defined in the mentioned
// IDL/IDH file.
// </remarks>
// --------------------------------------------------------------------------------------------
namespace Gecko
{
	using System;
	using System.Runtime.InteropServices;
	using System.Runtime.InteropServices.ComTypes;
	using System.Runtime.CompilerServices;
	
	
	/// <summary>
    /// The application cache service manages the set of application cache
    /// groups.
    /// </summary>
	[ComImport()]
	[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
	[Guid("03b41c3d-0816-4134-8b2e-4f5afbdb1f06")]
	public interface nsIApplicationCacheService
	{
		
		/// <summary>
        /// Create group string identifying cache group according the manifest
        /// URL and the given load context.
        /// </summary>
		[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
		void BuildGroupID([MarshalAs(UnmanagedType.Interface)] nsIURI aManifestURL, [MarshalAs(UnmanagedType.Interface)] nsILoadContextInfo aLoadContextInfo, [MarshalAs(UnmanagedType.LPStruct)] nsACStringBase retval);
		
		/// <summary>
        /// Same as buildGroupID method, just doesn't require load context.
        /// </summary>
		[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
		void BuildGroupIDForApp([MarshalAs(UnmanagedType.Interface)] nsIURI aManifestURL, uint aAppID, [MarshalAs(UnmanagedType.U1)] bool aInBrowser, [MarshalAs(UnmanagedType.LPStruct)] nsACStringBase retval);
		
		/// <summary>
        /// Create a new, empty application cache for the given cache
        /// group.
        /// </summary>
		[return: MarshalAs(UnmanagedType.Interface)]
		[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
		nsIApplicationCache CreateApplicationCache([MarshalAs(UnmanagedType.LPStruct)] nsACStringBase group);
		
		/// <summary>
        /// Create a new, empty application cache for the given cache
        /// group residing in a custom directory with a custom quota.
        ///
        /// @param group
        /// URL of the manifest
        /// @param directory
        /// Actually a reference to a profile directory where to
        /// create the OfflineCache sub-dir.
        /// @param quota
        /// Optional override of the default quota.
        /// </summary>
		[return: MarshalAs(UnmanagedType.Interface)]
		[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
		nsIApplicationCache CreateCustomApplicationCache([MarshalAs(UnmanagedType.LPStruct)] nsACStringBase group, [MarshalAs(UnmanagedType.Interface)] nsIFile profileDir, int quota);
		
		/// <summary>
        /// Get an application cache object for the given client ID.
        /// </summary>
		[return: MarshalAs(UnmanagedType.Interface)]
		[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
		nsIApplicationCache GetApplicationCache([MarshalAs(UnmanagedType.LPStruct)] nsACStringBase clientID);
		
		/// <summary>
        /// Get the currently active cache object for a cache group.
        /// </summary>
		[return: MarshalAs(UnmanagedType.Interface)]
		[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
		nsIApplicationCache GetActiveCache([MarshalAs(UnmanagedType.LPStruct)] nsACStringBase group);
		
		/// <summary>
        /// Deactivate the currently-active cache object for a cache group.
        /// </summary>
		[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
		void DeactivateGroup([MarshalAs(UnmanagedType.LPStruct)] nsACStringBase group);
		
		/// <summary>
        /// Deletes some or all of an application's cache entries.
        ///
        /// @param appId
        /// The mozIApplication.localId of the application.
        ///
        /// @param discardOnlyBrowserEntries
        /// If true, only entries marked as 'inBrowserElement' are deleted
        /// (this is used by browser applications to delete user browsing
        /// data/history.).  If false, *all* entries for the given appId are
        /// deleted (this is used for application uninstallation).
        /// </summary>
		[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
		void DiscardByAppId(int appID, [MarshalAs(UnmanagedType.U1)] bool discardOnlyBrowserEntries);
		
		/// <summary>
        /// Try to find the best application cache to serve a resource.
        /// </summary>
		[return: MarshalAs(UnmanagedType.Interface)]
		[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
		nsIApplicationCache ChooseApplicationCache([MarshalAs(UnmanagedType.LPStruct)] nsACStringBase key, [MarshalAs(UnmanagedType.Interface)] nsILoadContextInfo aLoadContextInfo);
		
		/// <summary>
        /// Flags the key as being opportunistically cached.
        ///
        /// This method should also propagate the entry to other
        /// application caches with the same opportunistic namespace, but
        /// this is not currently implemented.
        ///
        /// @param cache
        /// The cache in which the entry is cached now.
        /// @param key
        /// The cache entry key.
        /// </summary>
		[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
		void CacheOpportunistically([MarshalAs(UnmanagedType.Interface)] nsIApplicationCache cache, [MarshalAs(UnmanagedType.LPStruct)] nsACStringBase key);
		
		/// <summary>
        /// Get the list of application cache groups.
        /// </summary>
		[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
		void GetGroups(ref uint count, [MarshalAs(UnmanagedType.LPArray, SizeParamIndex=0)] ref string[] groupIDs);
		
		/// <summary>
        /// Get the list of application cache groups in the order of
        /// activating time.
        /// </summary>
		[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
		void GetGroupsTimeOrdered(ref uint count, [MarshalAs(UnmanagedType.LPArray, SizeParamIndex=0)] ref string[] groupIDs);
	}
}
